package plugin.demo.runner.apt.config.datasource;

import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.util.Arrays;
import java.util.List;
import java.util.Properties;

/**
 * @Author: Qiao Hang
 * @CreateDate: 2021/5/20 下午2:34
 * @UpdateDate:
 * @Description:
 */
public class AptMysqlConfig {

    private String dbType = "mysql";
    private Integer minConnection = 10;
    private Integer maxConnection = 100;
    private Boolean checkSql = Boolean.FALSE;

    private String dialect;

    private String[] dbs = {"mysql","scachem","test","admin"};

    private MysqlDriver driver = new MysqlDriver();

    private static class MysqlDriver{
        private String url;
        private String driverClass;
        private String username;
        private String password;
        @NestedConfigurationProperty
        private Properties properties = new Properties();

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getDriverClass() {
            return driverClass;
        }

        public void setDriverClass(String driverClass) {
            this.driverClass = driverClass;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public Properties getProperties() {
            return properties;
        }

        public void setProperties(Properties properties) {
            this.properties = properties;
        }
    }


    public String getDbType() {
        return dbType;
    }

    public void setDbType(String dbType) {
        this.dbType = dbType;
    }

    public Integer getMinConnection() {
        return minConnection;
    }

    public void setMinConnection(Integer minConnection) {
        this.minConnection = minConnection;
    }

    public Integer getMaxConnection() {
        return maxConnection;
    }

    public void setMaxConnection(Integer maxConnection) {
        this.maxConnection = maxConnection;
    }

    public Boolean getCheckSql() {
        return checkSql;
    }

    public void setCheckSql(Boolean checkSql) {
        this.checkSql = checkSql;
    }

    public String getDialect() {
        return dialect;
    }

    public void setDialect(String dialect) {
        this.dialect = dialect;
    }

    public String[] getDbs() {
        return dbs;
    }

    public void setDbs(String[] dbs) {
        this.dbs = dbs;
    }

    public MysqlDriver getDriver() {
        return driver;
    }

    public void setDriver(MysqlDriver driver) {
        this.driver = driver;
    }
}
